/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

/**
 *
 * @author ZSQ
 */
/**
 * 网络层类
 * 由基础组件与数据工程师实现
 */
//先定义 LayerType 枚举
// 层类型枚举：区分输入层、隐藏层、输出层，避免逻辑混淆

// Layer 类核心代码
import java.util.ArrayList;
import java.util.List;


public class Layer {
    private Neuron[] neurons;
    private ActivationFunction activationFunction;
    private double[] outputs;
    
    public Layer(int neuronCount, int inputSize, ActivationFunction activationFunction) {
        this.activationFunction = activationFunction;
        neurons = new Neuron[neuronCount];
        
        for (int i = 0; i < neuronCount; i++) {
            neurons[i] = new Neuron(inputSize);
        }
    }
    
    public double[] calculateOutputs(double[] inputs) {
        outputs = new double[neurons.length];
        
        for (int i = 0; i < neurons.length; i++) {
            outputs[i] = neurons[i].calculateOutput(inputs, activationFunction);
        }
        
        return outputs;
    }
    
    // Getter 方法
    public Neuron[] getNeurons() { return neurons; }
    public ActivationFunction getActivationFunction() { return activationFunction; }
    public double[] getOutputs() { return outputs; }
    public int getNeuronCount() { return neurons.length; }
}